package com.type.dao;

import java.util.ArrayList;

import javax.annotation.Resource;

import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.stereotype.Repository;

import com.type.vo.CorpVO;

@Repository("corpDAO")
public class CorpDAO {
	
	@Resource(name="sqlMapClientTemplate")
	private SqlMapClientTemplate sqlmap;
	
	public CorpVO selectCorpByName(String name) {		
		return (CorpVO) sqlmap.queryForObject("corp.selectCorpByName", name);
	}
	
	@SuppressWarnings("unchecked")
	public ArrayList<CorpVO> selectCorpList() {
		return (ArrayList<CorpVO>) sqlmap.queryForList("corp.selectCorpList");
	}
	
	public void insertCorp(CorpVO co) {
		sqlmap.insert("corp.registerCorp", co);
	}
	
	public void deleteCorp(int id) {
		sqlmap.delete("corp.deleteCorp", id);
	}
	
	public void updateCorp(CorpVO co) {
		sqlmap.update("corp.updateCorp", co);
	}

	public ArrayList selectCNameList() {
		// TODO Auto-generated method stub
		return (ArrayList) sqlmap.queryForList("corp.selectCNameList");
	}

}
